﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
using System.Drawing;
using ScreenMonitor.Common;

namespace ScreenMonitor.ServerLib
{
    /// <summary>
    /// 辅助类
    /// </summary>
    public static class ToolClass
    {
        /// <summary>
        /// 分割格式为宽*长的大小字符串
        /// </summary>
        /// <param name="Str">要分割的字符串</param>
        /// <returns>分割成的Size对象</returns>
        public static Size SplitSizeString(string Str)
        {
            string[] sa = Str.Split('*');
            if (sa.Count() == 2)
            {
                Size s = new Size(int.Parse(sa[0]), int.Parse(sa[1]));
                return s;
            }
            else
            {
                throw (new Exception("无效大小字符串！字符串格式应为宽*高！"));
            }
        }
    }

}
